package com.ng.framework.view.desktop;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;


public abstract class NGFrame extends JFrame {
	
	private static final long serialVersionUID = 2638143562711684741L;
	
	public static final Integer TEXT_FIELD_WIDTH = 70;
	public static final Integer BUTTON_HEIGHT = 23;
	public static final Integer BUTTON_WIDTH = 80;
	public static final Integer TEXT_FIELD_HEIGHT = 23;
	public static final Integer COMBO_WIDTH = 120;

	protected NGFrame containerFrame;
	protected NGTable dataTable;

	public boolean opcion = false;
	public boolean dialogo = false;

	public NGFrame() {

	}

	public void setOpcion(boolean opcion) {
		this.opcion = opcion;
	}

	public void centrar() {
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension frameSize = this.getSize();
		if (frameSize.height > screenSize.height) {
			frameSize.height = screenSize.height;
		}
		if (frameSize.width > screenSize.width) {
			frameSize.width = screenSize.width;
		}

		this.setLocation((screenSize.width - frameSize.width) / 2,
				(screenSize.height - frameSize.height) / 2);
		this.setVisible(true);
	}

	public NGFrame getContainerFrame() {
		return containerFrame;
	}

	public NGTable getDataTable() {
		return dataTable;
	}
	
	public abstract void refreshTable();
	
}
